package ru.duma.core;

/**
 * @author  cpp
 */
public class AIInput {

	private AISymbolManager manager = AISymbolManager.getInstance();
	
	private AIBrain brain = new AIBrain();
	
	public void sendIstina(String input, String output) throws EAIException {
		AIObjects iobj = manager.parse(input);
		AIObjects oobj = manager.parse(output);
		brain.educate(iobj, oobj);
	}
	
	public String getAnswer(String ask) throws EAIException  {
		AIObjects p = manager.parse(ask);
		AIObject answer = brain.getAnswer(p);
		if (answer != null) 
			return answer.toString();
		else
			return null;
	}
}
